import Book.BookShelf;
import User.Admin;
import User.NormalUser;
import User.User;

import java.util.Scanner;

public class Main {
    public static User login(){
        //登录并判断显示不同界面
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你的姓名:");
        String name=scanner.nextLine();
        System.out.println("请输入你的身份,1.管理员，2.普通用户:");
        int choice=scanner.nextInt();
        if(choice==1){
            return new Admin(name);
        }else {
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        //判断调用哪个对象
        BookShelf bookShelf=new BookShelf();
        User user=login();
        //根据返回值判断调用哪个对象的哪个方法
        while(true) {
            int choice = user.menu();
            user.doIoperation(choice, bookShelf);
        }
    }
}
